@using System.Globalization

<div class="container">
    <div class="row">
        <div class="col-sm-12 my-5">
            <RadzenCard class="w-100 mb-4" Style="display: flex; align-items: center; gap: 0.5rem">
                <RadzenLabel Text="Interpolation" For="interpolation" Style="margin-right: 1rem;"/>
                <RadzenDropDown AllowClear="false" Name="interpolation" @bind-Value="@interpolation"
                                TValue="Interpolation" ValueProperty="Value" TextProperty="Text"
                                Data="@(Enum.GetValues<Interpolation>().Select(v => new { Value = v, Text = $"{v:G}" }))"/>
            </RadzenCard>
            <RadzenChart>
                <RadzenLineSeries Interpolation="@interpolation" Data="@revenue2020" CategoryProperty="Date" Title="2019" LineType="LineType.Dashed" ValueProperty="Revenue" />
                <RadzenAreaSeries Interpolation="@interpolation" Data="@revenue2019" CategoryProperty="Date" Title="2020" ValueProperty="Revenue" />
                <RadzenCategoryAxis Padding="20" Formatter="@FormatAsMonth"/>
                <RadzenValueAxis Formatter="@FormatAsUSD">
                    <RadzenGridLines Visible="true"/>
                    <RadzenAxisTitle Text="Revenue in USD"/>
                </RadzenValueAxis>
            </RadzenChart>
        </div>
    </div>
</div>

@code {
    Interpolation interpolation = Interpolation.Line;

    class DataItem
    {
        public string Date { get; set; }
        public double Revenue { get; set; }
    }

    string FormatAsUSD(object value)
    {
        return ((double)value).ToString("C0", CultureInfo.CreateSpecificCulture("en-US"));
    }

    string FormatAsMonth(object value)
    {
        if (value != null)
        {
            return Convert.ToDateTime(value).ToString("MMM");
        }

        return string.Empty;
    }

    DataItem[] revenue2019 = new DataItem[] {
        new DataItem
        {
            Date = ("2019-01-01"),
            Revenue = 234000
        },
        new DataItem
        {
            Date = ("2019-02-01"),
            Revenue = 269000
        },
        new DataItem
        {
            Date = ("2019-03-01"),
            Revenue = 233000
        },
        new DataItem
        {
            Date = ("2019-04-01"),
            Revenue = 244000
        },
        new DataItem
        {
            Date = ("2019-05-01"),
            Revenue = 214000
        },
        new DataItem
        {
            Date = ("2019-06-01"),
            Revenue = 253000
        },
        new DataItem
        {
            Date = ("2019-07-01"),
            Revenue = 274000
        },
        new DataItem
        {
            Date = ("2019-08-01"),
            Revenue = 284000
        },
        new DataItem
        {
            Date = ("2019-09-01"),
            Revenue = 273000
        },
        new DataItem
        {
            Date = ("2019-10-01"),
            Revenue = 282000
        },
        new DataItem
        {
            Date = ("2019-11-01"),
            Revenue = 289000
        },
        new DataItem
        {
            Date = ("2019-12-01"),
            Revenue = 294000
        }
    };

    DataItem[] revenue2020 = new DataItem[] {
        new DataItem
        {
            Date = ("2019-01-01"),
            Revenue = 334000
        },
        new DataItem
        {
            Date = ("2019-02-01"),
            Revenue = 369000
        },
        new DataItem
        {
            Date = ("2019-03-01"),
            Revenue = 333000
        },
        new DataItem
        {
            Date = ("2019-04-01"),
            Revenue = 344000
        },
        new DataItem
        {
            Date = ("2019-05-01"),
            Revenue = 314000
        },
        new DataItem
        {
            Date = ("2019-06-01"),
            Revenue = 353000
        },
        new DataItem
        {
            Date = ("2019-07-01"),
            Revenue = 374000
        },
        new DataItem
        {
            Date = ("2019-08-01"),
            Revenue = 384000
        },
        new DataItem
        {
            Date = ("2019-09-01"),
            Revenue = 373000
        },
        new DataItem
        {
            Date = ("2019-10-01"),
            Revenue = 382000
        },
        new DataItem
        {
            Date = ("2019-11-01"),
            Revenue = 389000
        },
        new DataItem
        {
            Date = ("2019-12-01"),
            Revenue = 394000
        }
    };
}